#!/bin/bash
set -e
echo "Building openssh.."

useradd sshd -s /sbin/nologin -M
tar -xf /sources/openssh*.tar.gz -C /tmp/ \
  && mv /tmp/openssh* /tmp/openssh \
  && pushd /tmp/openssh
./configure --prefix=/usr --without-openssl

make -j$(lscpu | grep '^CPU(s):' | awk '{print $2}')

make install

# cleanup
popd \
  && rm -rf /tmp/openssh
